<include file="Public/head"/>
<body class="no-skin">
<include file="Public/header"/>
<div class="main-container" id="main-container">
    <script type="text/javascript">
        try {
            ace.settings.check('main-container', 'fixed')
        } catch (e) {
        }
    </script>

    <include file="Public/sidebar"/>
    <div class="main-content">
        <div class="main-content-inner">
            <!-- #section:basics/content.breadcrumbs -->
            <include file="Public/breadcrumbs"/>

            <!-- /section:basics/content.breadcrumbs -->
            <div class="page-content">
                <include file="Public/set"/>

                <!-- /section:settings.box -->
                <div class="row">
                    <div class="col-xs-12">
                        <form action="{:U('add')}" method="get" style="margin-left: 68%">
                            <input type="text"  style="position:absolute;margin-left:-190px;width: 180px;" name="keyword" value="{:I('keyword')}" class="form-control" style="width: 10%">
                            <button type="submit" class="btn btn-purple btn-sm">
                                <span class="ace-icon fa fa-search icon-on-right bigger-110"></span>
                                搜索
                            </button>
                        </form>
                        <table class="table table-striped table-bordered " style="width: 70%;margin-top: 1%;margin-left:3%">
                            <thead>
                            <tr>
                                <th  class="center">小说名称</th>
                                <th  class="center">章节总数</th>
                                <th  class="center">操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <volist name="novel" id="val">
                                <tr>
                                    <td class="center" style="width: 50%" id="name">{$val['name']}</td>
                                    <td class="center" id="total">共{$val['total']}章</td>
                                    <td class="center" id="novel_{$val['id']}"><a href="javascript:void(0)">添加</a></td>
                                </tr>
                            </volist>
                            </tbody>
                        </table>
                        <div style="margin-left: 20%">{$page}</div>


                        <form class="form-horizontal" id="form" method="post" action="{:U('update')}" style="margin-left: 10%">

                            <input type="hidden" name="id" value="{$recommend.id}" id="id"/>
                            <div class="space-4"></div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label no-padding-right" for="form-field-0">
                                    小说名称 </label>
                                <div class="col-sm-9" style="width:90%;">
                                    <input type="text" name="novel_name" id="novel_name" placeholder="小说名称"
                                           class="col-xs-10 col-sm-5" value="{$recommend['novel_name']}">
                                    <span class="help-inline col-xs-12 col-sm-7">
												<span class="middle">小说名称</span>
											</span>
                                </div>
                            </div>
                            <div class="form-group" >
                                <label class="col-sm-1 control-label no-padding-right" for="form-field-2">
                                    小说章节</label>
                                <div class="col-sm-9" style="width: 90%">
                                    <input type="text" name="chapter_name" id="chapter_name" placeholder="小说章节"
                                           class="col-xs-10 col-sm-5" value="{$recommend['chapter_name']}">
                                    <span class="help-inline col-xs-12 col-sm-7">
												<span class="middle">小说章节</span>
											</span>
                                </div>
                            </div>
                            <div class="col-md-offset-2 col-md-9" style="width: 80%">
                                <button class="btn btn-info submit">
                                    <i class="icon-ok bigger-110"></i>
                                    提交
                                </button>

                                &nbsp; &nbsp; &nbsp;
                                <button class="btn" type="reset">
                                    <i class="icon-undo bigger-110"></i>
                                    重置
                                </button>
                            </div>
                        </form>
                    </div><!-- /.col -->
                </div><!-- /.row -->
            </div><!-- /.page-content -->
        </div>
    </div><!-- /.main-content -->
    <include file="Public/footer"/>

</div><!-- /.main-container -->

<include file="Public/footerjs"/>
<!-- inline scripts related to this page -->
<script type="text/javascript">
    $(function () {
        $("#tabs").tabs();
        var editor = KindEditor.create('textarea[name="content"]', {
            uploadJson: '__PUBLIC__/kindeditor/php/upload_json.php',
            fileManagerJson: '__PUBLIC__/kindeditor/php/file_manager_json.php',
            allowFileManager: true,
            afterBlur: function () {
                this.sync();
            }
        });
        $(".submit").click(function () {
            var sid = $("#sid").val();
            var title = $("#title").val();
            var content = $("#content").val();
            if (sid == 0) {
                bootbox.dialog({
                    title: '友情提示：',
                    message: "文章分类必须选择。",
                    buttons: {
                        "success": {
                            "label": "确定",
                            "className": "btn-danger"
                        }
                    }
                });
                return;
            }
            if (title == '') {
                bootbox.dialog({
                    title: '友情提示：',
                    message: "文章标题必须填写。",
                    buttons: {
                        "success": {
                            "label": "确定",
                            "className": "btn-danger"
                        }
                    }
                });
                return;
            }
            if (content == '') {
                bootbox.dialog({
                    title: '友情提示：',
                    message: "文章内容需要填写。",
                    buttons: {
                        "success": {
                            "label": "确定",
                            "className": "btn-danger"
                        }
                    }
                });
                return;
                return;
            }
            $("#form").submit();
        });
    });
    $(function(){
        $('.center').click(function(){
            var a = $(this).parent().find('.center').eq(0).text();
            $('#novel_name').prop('value',a);
        });
    });
</script>
</body>
</html>
